package DesignPattern.Behavior.Interpreter;

public class Client {
    public static void main(String[] args) {
        Context context = new Context();

        Variable var1 = new Variable("a");
        Variable var2 = new Variable("b");
        Variable var3 = new Variable("c");
        Variable var4 = new Variable("d");

        context.assign(var1, 1);
        context.assign(var2, 2);
        context.assign(var3, 3);
        context.assign(var4, 4);

        AbstractExpression abstractExpression = new Minus(var1, new Plus(new Minus(var2, var3), var4));
        int result = abstractExpression.interpret(context);
        System.out.println(abstractExpression + "=" + result);
    }
}
